﻿<div class="all-elements">
    <div id="sidebar" class="page-sidebar">
        <div class="page-sidebar-scroll">
            <div class="nav-item selected-nav-item" data-ng-repeat="r in roleByGroup">
                <a href="#/{{r.RoleValue}}">
                    <div class="icon-nav {{r.RoleValue}}"></div>
                    {{r.RoleName}}
                </a>
            </div>
            <div class="nav-item">
                <a href="#">
                    <div class="icon-nav icon-share" onclick="logout()"></div>
                    THOÁT
                </a>
                <script>
                    function logout() {
                        localStorage.removeItem("idkey");
                        localStorage.removeItem("authen");
                        localStorage.removeItem("menu");
                        $location.path('/login/');
                    }
                </script>
            </div>
        </div>
    </div>



    <div id="content" class="page-content">

        <div class="page-header">
            <p class="logo">
            </p>

            <a href="#" class="deploy-sidebar"></a>
            <div class="user">
                <span class="name">{{userName}}</span>
                <div class="notifi">
                    <span class="noti-chart" ng-show="countNewMessage>0"><a href="#/newMessage">{{countNewMessage}}</a></span>
                    <span class="noti-friend" ng-show="countAddFriend>0"><a href="#/newFriend">{{countAddFriend}}</a></span>
                    <span class="noti-fromroom" ng-show="countFromRoom>0"><a href="#/newFromRoom">{{countFromRoom}}</a></span>
                </div>
            </div>
        </div>

        <div class="page-content-wrapper">
            <div class="container no-bottom">
                <div class="heading">
                    <div class="heading-left">
                        <h3>Quản lý phân quyền</h3>
                    </div>

                </div>
            </div>
            <div class="container">

                <div class="page-content-wrapper">
                    <div class="container no-bottom">
                        <div id="role-tab" class="tab"><span ng-click="groupRoleShowClick()">phân quyền</span><span ng-click="roleShowClick()">Quyền</span><span ng-click="groupShowClick()">Nhóm quyền</span></div>
                        <div class="decoration"></div>

                        <div ng-show="groupRoleShow">
                            <!--bảng phân quyền-->
                            <div class="t-title">
                                <table>
                                    <tr class="tr-size" data-ng-repeat="r in roles">
                                        <th class="table-sub-title">{{r.RoleName}}</th>
                                    </tr>
                                </table>
                            </div>
                            <div class="t-content">
                                <table>
                                    <tr class="tr-size">
                                        <th class="table-title" data-ng-repeat="g in groups">{{g.GroupName}}</th>
                                    </tr>
                                    <tr class="tr-size" ng-repeat="row in groupRoles">
                                        <td ng-repeat="cell in row track by $index" ng-click="changeGroupRole(cell.GroupId,cell.RoleId,cell.Id)"><span ng-show="{{cell.Value}}" class=" icon-ok-1 icon-inline red-icon"></span></td>
                                    </tr>
                                </table>
                            </div>
                        </div>



                        <div class="decoration"></div>

                        <div ng-show="roleShow">
                            <!--<div ng-click="addRoleHeader()"><span class="float-left">thêm quyền</span><span class="icon-add-1 icon-inline float-left"></span></div>-->
                            <form name="addRoleForm" ng-show="addRolePanel">
                                Tên quyền:
                                <input ng-model="roleItem.RoleName" required />
                                Mô tả:
                                <input ng-model="roleItem.Description" required />
                                <button type="submit" ng-disabled="!addRoleForm.$valid" ng-click="addRole()">Thêm</button>
                            </form>
                            <!--bảng quyền-->
                            <table class="table">
                                <tr>
                                    <th colspan="2" class="table-title">Danh sách quyền</th>
                                </tr>

                                <tr data-ng-repeat="l in roles" id="role_{{l.Id}}">
                                    <td class="table-sub-title">{{l.RoleName}}</td>
                                    <td>{{l.Description}}</td>
                                    <!--<td ng-click="delRole(l.Id)"><span class="icon-remove-sign-3 icon-inline blue-icon right"></span></td>-->
                                </tr>
                            </table>
                        </div>
                        <div ng-show="groupShow">
                            <div ng-click="addGroupHeader()"><span class="float-left">thêm nhóm quyền</span><span class="icon-add-1 icon-inline float-left"></span></div>
                            <form name="addGroupForm" ng-show="addGroupPanel">
                                Tên nhóm:
                                <input ng-model="groupItem.GroupName" required />
                                Mô tả:
                                <input ng-model="groupItem.Description" required />
                                <button type="submit" ng-disabled="!addGroupForm.$valid" ng-click="addGroup()">Thêm</button>
                            </form>
                            <!--bảng group-->
                            <table class="table">
                                <tr>
                                    <th colspan="3" class="table-title">Danh sách nhóm</th>
                                </tr>

                                <tr data-ng-repeat="g in groups" id="group_{{g.Id}}">
                                    <td class="table-sub-title">{{g.GroupName}}</td>
                                    <td>{{g.Description}}</td>
                                    <td ng-click="delGroup(g)"><span class="icon-remove-sign-3 icon-inline blue-icon right"></span></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--<div class="footer">
            <div class="footer-shortcuts">
                <a href="room.html">
                    <div><span class="button-bottom icon-back-room"></span><span class="button-text">Quay về</span></div>
                </a>
                <a href="#">
                    <span class="button-bottom icon-only icon-arrow-up"></span>
                </a>
                <a href="#">
                    <div><span class="button-text">Bài tiếp theo</span><span class="button-bottom icon-next-lesson"></span></div>
                </a>
            </div>
        </div>-->
    </div>
</div>
